# Maintainer: David Mott <mott.david.j@gmail.com>
# Contributor: Niklas Holm <jadedcyborg@gmail.com>

pkgname='parallel'
pkgver='20191022'
pkgrel='1'
pkgdesc='A shell tool for executing jobs in parallel'
arch=('any')
url='https://www.gnu.org/software/parallel/'
license=('GPL3')
depends=('perl')
source=("https://ftpmirror.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.bz2"{,".sig"}
        "0001-support-MSys2.patch")
validpgpkeys=('CDA01A4208C4F74506107E7BD1AB451688888888')
sha256sums=('641beea4fb9afccb1969ac0fb43ebc458f375ceb6f7e24970a9aced463e909a9'
            'SKIP'
            '88e9724a31e0dbbf7909305708499c28fcb794a9783b057202da5db8d7ade0b1')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i "${srcdir}/0001-support-MSys2.patch"

  # ACLOCAL_PATH is needed to pick up local m4 macro
  ACLOCAL_PATH="${srcdir}/${pkgname}-${pkgver}" autoreconf -vif
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --build="${CHOST}" \
    --host=${CHOST} \
    --target=${CHOST} \
    --prefix="/usr"
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
